#brute force

import time
import math
import itertools as it

def prime(n):
	factors = [i for i in range(2, int(math.sqrt(n)+1)) if n%i==0]
	return len(factors)==0

def prime_gen():
	i = 3 
	n = 2 
	yield 2
	while 1:
		if (prime(i)): 
			#yield i,n
			yield i
			n += 1
		i += 2

assert( sum(it.takewhile(lambda x: x<10, prime_gen() )) == 17)
s = sum(it.takewhile(lambda x: x<2e6, prime_gen() ))
print(s)

